#include<bits/stdc++.h>
using namespace std;
int main()
{
	int Au=0,Ag=0,Cu=0,n,a,b,c,i;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		cin>>a>>b>>c;
		Au+=a,Ag+=b,Cu+=c;
	}
	cout<<Au<<" "<<Ag<<" "<<Cu<<" "<<Au+Ag+Cu;
    return 0;
}
